FROM ubuntu:22.04

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

RUN useradd -m -s /bin/bash ubuntu && \ 
echo "ubuntu:123456" | chpasswd
WORKDIR /home/ubuntu

# 切换到 root 用户以安装依赖项
USER root
RUN echo 'root:123456' | chpasswd

ENV DEBIAN_FRONTEND=noninteractive

# 安装其他依赖项
RUN apt update && apt upgrade && apt-get install -y vim sudo curl git
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash && \ 
apt-get install -y nodejs && npm install -y -g hexo-cli 

RUN git clone https://gitee.com/XLynngitee/hexo_blog && \
cd hexo_blog && npm install

USER ubuntu
ENTRYPOINT ["bash", "-c", "/entrypoint.sh"]
